﻿<Page
    x:Class="DvachBrowser3.Views.PostingPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:DvachBrowser3.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="using:DvachBrowser3.ViewModels"
    xmlns:pa="using:DvachBrowser3.Views.Partial"
    xmlns:behaviors="using:Template10.Behaviors"
    xmlns:ps="using:DvachBrowser3.PageServices"
    xmlns:localBehaviors="using:DvachBrowser3.Behaviors"
    xmlns:controls="using:Template10.Controls"
    xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
    x:Name="ThisPage"
    mc:Ignorable="d">
    
    <Page.Resources>
        <DataTemplate x:DataType="x:String" x:Key="PostingPivotHeaderTemplate">
            <TextBlock FontWeight="Bold" Margin="3, 3, 3, 7" Text="{x:Bind}" FontSize="14.5"/>
        </DataTemplate>
    </Page.Resources>

    <ps:PageServices.Services>
        <ps:PageServiceCollection>
            <ps:ShellAppBarPageService />
            <ps:ViewModelLifetimePageService />
        </ps:PageServiceCollection>
    </ps:PageServices.Services>

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="100*"/>
        </Grid.RowDefinitions>

        <controls:PageHeader BackButtonVisibility="Collapsed" Frame="{x:Bind Frame, Mode=OneWay}" FontWeight="Bold"
                             Content="{x:Bind HeaderText, Mode=OneWay}">
            <interactivity:Interaction.Behaviors>
                <behaviors:EllipsisBehavior Visibility="Collapsed" />
            </interactivity:Interaction.Behaviors>
        </controls:PageHeader>

        <pa:ProgressIndicatorControl Grid.Row="1" ViewModel="{x:Bind ViewModel.Posting.Progress, Mode=OneWay}" ShowMessage="True" />

        <Grid Grid.Row="2" x:Name="MainGrid">
            <pa:PostingEntryView ViewModel="{x:Bind ViewModel, Mode=OneWay}" />
        </Grid>
        <pa:ContentPopup Grid.Row="2" x:Name="QuotePopup" IsContentVisibleChanged="Popup_OnIsContentVisibleChanged" HideCloseButton="True" IsContentVisible="{x:Bind ShowQuote, Mode=OneWay}">
            <pa:ContentPopup.ViewContent>
                <Grid Margin="4">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="100*"/>
                    </Grid.RowDefinitions>
                    <Border Grid.Row="0" Margin="0, 0, 0, 4" BorderBrush="{ThemeResource SystemControlBackgroundChromeMediumBrush}" BorderThickness="0, 0, 0, 1">
                        <TextBlock FontSize="{x:Bind StyleManager.Text.ListHeaderFontSize, Mode=OneWay}">Цитата</TextBlock>
                    </Border>
                    <ScrollViewer Grid.Row="1" HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
                        <TextBlock FontSize="{x:Bind StyleManager.Text.NormalFontSize, Mode=OneWay}" Margin="4" TextWrapping="Wrap" Text="{x:Bind ViewModel.Quote, Mode=OneWay}" IsTextSelectionEnabled="True">
                            <interactivity:Interaction.Behaviors>
                                <localBehaviors:CleanListContentMarginBehavior NormalThickness="{StaticResource CleanListPadding}" NarrowThickness="{StaticResource CleanListPaddingNarrow}" />
                            </interactivity:Interaction.Behaviors>
                        </TextBlock>
                    </ScrollViewer>
                </Grid>
            </pa:ContentPopup.ViewContent>
        </pa:ContentPopup>

        <pa:ContentPopup Grid.Row="2" x:Name="CaptchaPopup" IsContentVisibleChanged="Popup_OnIsContentVisibleChanged" HideCloseButton="False">
            <pa:ContentPopup.ViewContent>
                <Grid Margin="4">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="100*"/>
                    </Grid.RowDefinitions>
                    <Border Grid.Row="0" Margin="0, 0, 0, 4" BorderBrush="{ThemeResource SystemControlBackgroundChromeMediumBrush}" BorderThickness="0, 0, 0, 1">
                        <TextBlock FontSize="{x:Bind StyleManager.Text.ListHeaderFontSize, Mode=OneWay}">Капча</TextBlock>
                    </Border>
                    <pa:CaptchaQueryView Grid.Row="1" x:Name="CaptchaQueryView" CaptchaQueryResult="CaptchaQueryView_OnCaptchaQueryResult">
                    </pa:CaptchaQueryView>
                </Grid>
            </pa:ContentPopup.ViewContent>
        </pa:ContentPopup>
    </Grid>
</Page>
